package com.chinaisafe.user.dto;

import com.chinaisafe.user.entity.SysUserDept;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * SysUserDeptDTO
 * Description：用户部门关系数据传输对象
 *
 * @author xuefu.shu
 * @date  2024-07-12 11:13:03
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@Schema(name = "SysUserDeptDTO", description = "用户部门关系数据传输对象")
public class SysUserDeptDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "主键id")
    private Long id;

    @Schema(description = "部门_id")
    private Long sysDeptId;

    @Schema(description = "用户_id")
    private Long sysUserId;

    @Schema(description = "是否主部门")
    private Boolean mainDept;

    @Schema(description = "部门维度id")
    private Long deptDimensionId;

    @Schema(description = "部门维度名称")
    private String deptDimensionName;


    /**
     * 将实体类转换为数据传输对象
     * @param entity 实体对象
     * @return SysUserDeptDTO 数据传输对象
     * @author xuefu.shu
     * @date 2024-07-12 11:13:03
     */
    public static SysUserDeptDTO convertFromEntity(SysUserDept entity) {
        SysUserDeptDTO dto = new SysUserDeptDTO();
        dto.id = entity.getId();
        // 给对应的字段赋值 可根据实际业务删减
        dto.sysDeptId = entity.getSysDeptId();
        dto.sysUserId = entity.getSysUserId();
        dto.mainDept = entity.getMainDept();
        dto.deptDimensionId = entity.getDeptDimensionId();
        dto.deptDimensionName = entity.getDeptDimensionName();
        return dto;
    }
}
